package com.hyt.it.ogt.kq.service.bm.model.param;

import com.hyt.it.ogt.cj.enums.ComponentNameEnum;
import com.hyt.it.ogt.cj.model.vo.ProjectCollectInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * @program: it-ogt-bm
 * @description: 考生导入参数
 * @author: Yang HuanKun
 * @create: 2022-03-30 18:27
 **/
@Data
@ApiModel(value = "ProjectStudentImportRecordParam对象", description = "考生导入参数")
public class ProjectStudentImportRecordParam {

    @ApiModelProperty(value = "是否有电话号码")
    private Boolean phoneflag = false;
    
    @ApiModelProperty(value = "是否有邮箱")
    private Boolean emailflag = false;
    
    @ApiModelProperty(value = "是否有证件号码")
    private Boolean idcardflag = false;
    
    @ApiModelProperty(value = "是否有准考证")
    private Boolean admissionnoflag = false;

    
    
	public static ProjectStudentImportRecordParam  buildParamsFlag(List<ProjectCollectInfoVo> volist) {
		ProjectStudentImportRecordParam projectStudentImportRecordParam = new ProjectStudentImportRecordParam();
		if(CollectionUtils.isEmpty(volist)) {
			return projectStudentImportRecordParam;
		}
		boolean phoneflag = false;
		boolean emailflag = false;
		boolean idcardflag = false;
		boolean admissionnoflag = false;
		for (int i = 0; i < volist.size(); i++) {
			if (ComponentNameEnum.phone.getDesc().equals(volist.get(i).getTitle())) {
				phoneflag = true;
			}
			if (ComponentNameEnum.email.getDesc().equals(volist.get(i).getTitle())) {
				emailflag = true;
			}
			if (ComponentNameEnum.certificatetype.getDesc().equals(volist.get(i).getTitle())) {
				idcardflag = true;
			}
			if (ComponentNameEnum.admissionno.getDesc().equals(volist.get(i).getTitle())) {
				admissionnoflag = true;
			}
		}
		projectStudentImportRecordParam.setAdmissionnoflag(admissionnoflag);
		projectStudentImportRecordParam.setPhoneflag(phoneflag);
		projectStudentImportRecordParam.setEmailflag(emailflag);
		projectStudentImportRecordParam.setIdcardflag(idcardflag);
		return projectStudentImportRecordParam;
	}
}
